<template>
  <div class="content">
    <div class="c_left">
      <HomeDataCard/>
      <div class="lineview">
        <HomeLineView/>
      </div>
    </div>
    <div class="c_right">
      <HomeMsgCard/>
    </div>
  </div>
</template>

<script lang="ts" setup>
import { reactive,onMounted } from "vue";
import { getcounts } from "../../service/homeindex/datacounts";
import { repairsdata,questionsdata } from "../../service/homeindex/pendingdata";
import { homedata } from "../../service/homeindex/type";
import HomeLineView from "../../components/HomeLineView.vue";
import HomeMsgCard from "../../components/HomeMsgCard.vue";
import HomeDataCard from "../../components/HomeDataCard.vue";
let counts = reactive<homedata>(
    {
    houses:0,
    notAnswer: 0,
    notFinishedRepairs: 0,
    questions: 0,
    repairs: 0,
    stores: 0,
    todayQuestions: 0,
    todayRepairs: 0,
    users: 0
}) ;
//获取各类总数
const getdata = async() => {
    let res = await getcounts() ;
    Object.assign(counts, res.data)
};

//获取未处理报修
let repairdata = reactive<any>({list:[]});
const getrepairdata = async() => {
    let res = await repairsdata({state:0,page:1,psize:5}) ;
    repairdata.list = res.data.list;
};
//获取未处理问题
let questiondata = reactive<any>({list:[]});
const getquestionsdata = async() => {
    let res = await questionsdata({state:0,page:1,psize:5}) ;
    questiondata.list = res.data.list;
};


onMounted(() => {
    getdata()
    getrepairdata()
    getquestionsdata()
})
</script>

<style lang="less" scoped>
@import url(../../assets/home/homeindex.less);
</style>
